﻿@model yule.CodeBuilder.Core.PDM.PdmReader
@{
    
}
<script type="text/javascript">
    function PDMTableSelect(tableName, description) {
        if (window["OnPDMTableSelect"]) {
            window.OnPDMTableSelect(tableName, description);
        } else {
            alert("请在本控件引用位置下重写本函数\r\n" + "function OnPDMTableSelect(tableName,description){}");
        }
    }
    function PDMTableSelectAll(checked) {
        if (checked == null) {
            var checked = !$("#cbk_table_all").attr("checked");
        }
        var v_checked = checked == true ? "checked" : "";
        $("input[name=cbk_table]").each(function () {
            $(this).attr("checked", v_checked);
        });
    }
    function GetPDMSelectTables() {
        var tables = [];
        $("input[name=cbk_table]").each(function () {
            var cbk = $(this);
            if (cbk.attr("checked") == true) {
                tables[tables.length] = cbk.val();
            }
        });
        return tables;
    }
</script>
<div>
    <input type="checkbox" id="cbk_table_all" onclick="PDMTableSelectAll(this.checked);" />
    <label for="cbk_table_all" onclick="PDMTableSelectAll();">选择全部</label>
</div>
@foreach (yule.CodeBuilder.Core.PDM.TableInfo table in this.Model.Tables.Values)
{
    string cbk_id = "cbk_table_" + table.Core;
    <div >
        <input type="checkbox" name="cbk_table" id="@cbk_id" value="@table.Core" />
        <label title="@table.Name" onclick="PDMTableSelect('@table.Core','@table.Name')">@table.Name</label>
    </div>
}
@*@Html.Action("Tree", "Control")*@